/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * This file is part of retabel.
 *
 * Copyright (c) 2011 by individual contributors as indicated by the
 * @author tags. See the copyright.txt file in the distribution
 * for a full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */

package org.retabel.persistence.entity.document;

import javax.persistence.*;

/**
 * Class description.
 * <p/>
 * <h3>Extra-Info</h3>
 * Created: 21:15 31.07.11
 *
 * @author Burt Parkers
 * @version 1.0
 */
@Entity
@NamedQueries({
    @NamedQuery(name = "ExportConfiguration.findByName",
                query = "select exportConfiguration from ExportConfiguration exportConfiguration where " +
                        "exportConfiguration.name = ?1")
})
public class ExportConfiguration {

    /** The id field. */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int id;

    /** Name of the configuration. */
    @Column(nullable = false, length = 50, unique = true)
    private String name;

    /** Content Type of the export. */
    @Enumerated
    private ContentTypeEnum contentType;

    /** Name of the configuration. */
    @Column(nullable = false, length = 500)
    private String location;

    /**
     * Returns the id.
     *
     * @return the id.
     */
    public int getId() {
        return id;
    }

    /**
     * Sets the id.
     *
     * @param id the id.
     */
    public void setId(int id) {
        this.id = id;
    }

    /**
     * Returns the name.
     *
     * @return the name.
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the name.
     *
     * @param name the name.
     */
    public void setName(String name) {
        this.name = name;
    }


    /**
     * Gets the location.
     *
     * @return The location value.
     */
    public String getLocation() {
        return location;
    }

    /**
     * Sets the location.
     *
     * @param location The location value to set.
     */
    public void setLocation(String location) {
        this.location = location;
    }

    /**
     * Sets the contentType.
     *
     * @param contentType The contentType value to set.
     */
    public void setContentType(ContentTypeEnum contentType) {
        this.contentType = contentType;
    }

    /**
     * Gets the contentType.
     *
     * @return The contentType value.
     */
    public ContentTypeEnum getContentType() {
        return contentType;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ExportConfiguration that = (ExportConfiguration) o;

        return id == that.id && name.equals(that.name);
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + name.hashCode();
        return result;
    }

}
